﻿using ContactSMS.Commons.Util;

namespace ContactSMS.Domain.Entity
{
    public class PhoneRecord
    {
        public long Id { get; set; }
        public long UserId { get; set; }
        public long ContactId { get; set; }
        //public long? ContactId { get; set; }
        public string Mobile { get; set; }
        public bool Status { get; set; }
        public long CallTime { get; set; }
        public long CreatTime { get; set; }
        public long UpdateTime { get; set; }
        public virtual Contact Contact { get; set; }

        public PhoneRecord() { }

        public PhoneRecord(string mobile, long contactId = 0)
        {
            this.ContactId = contactId;
            this.Mobile = mobile;
            this.CreatTime = TimeUtil.GetTimestamp();
            this.UpdateTime = TimeUtil.GetTimestamp();
        }

        public PhoneRecord(string mobile, bool status = false, long callTime = 0, long contactId = 0, long userId = 0)
        {
            this.ContactId = contactId;
            this.Mobile = mobile;
            this.CallTime = callTime > 0 ? callTime : TimeUtil.GetTimestamp();
            this.CreatTime = TimeUtil.GetTimestamp();
            this.UpdateTime = TimeUtil.GetTimestamp();
            UserId = userId;
            Status = status;
        }
    }
}
